package cn.com.ddapp.ddm.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.VideoView;

import butterknife.BindView;
import butterknife.ButterKnife;
import cn.com.ddapp.ddm.R;
import cn.com.ddapp.ddm.widget.video.CommonVideoView;

/**
 * Created by Administrator on 2016/9/1 0001.
 */
public class VideoAdapter extends BaseAdapter {
	private Context context;

	public VideoAdapter(Context context) {
		this.context = context;
	}

	@Override
	public int getCount() {
		return 2;
	}

	@Override
	public Object getItem(int i) {
		return null;
	}

	@Override
	public long getItemId(int i) {
		return 0;
	}

	@Override
	public View getView(int i, View view, ViewGroup viewGroup) {
		ViewHolder holder = null;
		if (view == null) {
			view = LayoutInflater.from(context).inflate(R.layout.item_video_add, viewGroup, false);
			holder = new ViewHolder(view);
			view.setTag(holder);
		} else {
			holder = (ViewHolder) view.getTag();
		}

		holder.videoView.start("http://baobab.wdjcdn.com/145076769089714.mp4");

		return view;
	}

	class ViewHolder {
		@BindView(R.id.videoView)
		CommonVideoView videoView;

		ViewHolder(View view) {
			ButterKnife.bind(this, view);
		}
	}
}
